home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-12-08 | 47.1 KB | 1,262 lines | [TEXT/R*ch] |
- C.S.M.P. Digest Mon, 02 Nov 92 Volume 1 : Issue 203
-
- Today's Topics:
-
- Formatting a disk in the background
- TCL/UnloadSeg Help Needed
- ProcPtr, how to call Proc pointed to?
- Unloading Segments
- Get sender address from an AppleEvent
- GrowZone & A5
- Measuring text in different fonts
- MacTCPCommonTypes & typedef unsigned char b_8.
- Postscript downloading.
- popup menus in non-system font
-
-
-
- The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
-
- The digest is a collection of article threads from the internet newsgroup
- comp.sys.mac.programmer. It is designed for people who read c.s.m.p. semi-
- regularly and want an archive of the discussions. If you don't know what a
- newsgroup is, you probably don't have access to it. Ask your systems
- administrator(s) for details. (This means you can't post questions to the
- digest.)
-
- Each issue of the digest contains one or more sets of articles (called
- threads), with each set corresponding to a 'discussion' of a particular
- subject. The articles are not edited; all articles included in this digest
- are in their original posted form (as received by our news server at
- cs.uoregon.edu). Article threads are not added to the digest until the last
- article added to the thread is at least one month old (this is to ensure that
- the thread is dead before adding it to the digest). Article threads that
- consist of only one message are generally not included in the digest.
-
- The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
- [128.223.8.8] in the directory /pub/mac/csmp-digest. Be sure to read the
- file /pub/mac/csmp-digest/README before downloading any files. The most
- recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
- directory /info-mac/digest/csmp. If you don't have ftp capability, the sumex
- archive has a mail server; send a message with the text '$MACarch help' (no
- quotes) to LISTSERV@ricevm1.rice.edu for more information.
-
- The digest is also available via email. Just send a note saying that you
- want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
- automatically receive each new issue as it is created. Sorry, back issues
- are not available through the mailing list.
-
- Send administrative mail to mkelly@cs.uoregon.edu.
-
-
- -------------------------------------------------------
-
- From: peterbak@microsoft.com (Peter Bako)
- Subject: Formatting a disk in the background
- Date: 31 Aug 92 22:30:46 GMT
- Organization: Microsoft Corp.
-
-
- I have a small application that automatically formats disk, but
- can only do so while it is in the foreground. How can I make
- the program be able to format a disk in the background? Either
- by running the program in the background, or to move it there once
- it has started its process.
-
- Thanks,
-
- Peter
-
- - --
- (*)-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\/-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+(*)
- ( UUCP: peterbak@microsoft || Is this all that I am? Is there )
- ( CompuServe: 71170,1426 || nothing more? - V'ger )
- (*)-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-/\-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+(*)
-
- +++++++++++++++++++++++++++
-
- From: reed@snake.tc.cornell.edu (Michael G. Reed)
- Date: 1 Sep 92 12:12:35 GMT
- Organization: Cornell National Supercomputing Facility
-
- In article <1992Aug31.223046.8274@microsoft.com>, peterbak@microsoft.com (Peter Bako) writes:
- |>
- |> I have a small application that automatically formats disk, but
- |> can only do so while it is in the foreground. How can I make
- |> the program be able to format a disk in the background? Either
- |> by running the program in the background, or to move it there once
- |> it has started its process.
- |>
- I don't think it can be done. The problem is that reads/writes to floppy
- disks are VERY time critical. Therefore, most OS's will disable interupts
- and require the formatting code to run exclusively if you want a "properly"
- formatted disk. This happens on the mac (that's why the mouse "jumps" when
- you are formatting disks...the mouse is interupt driven), so I don't think
- you're going to be able to get around it with Apple's routines...You could
- always write your own disk I/O routines :) (just kidding).
-
- - -Michael
-
- - -----------------------------------------------------------------------------
- Michael G. Reed (reed@Theory.TC.Cornell.edu)
- Cornell National Supercomputing Facility (607)/254-8806
- - -----------------------------------------------------------------------------
- Why be normal, it's boring; and boring people should be shot.
-
- Note: These are not the views of my employer (and probably not mine either).
-
- +++++++++++++++++++++++++++
-
- From: Quinn <quinn@cs.uwa.edu.au>
- Organization: The University of Western Australia
- Date: Wed, 2 Sep 1992 01:28:22 GMT
-
- In article <1992Sep1.121235.11175@tc.cornell.edu> Michael G. Reed,
- reed@snake.tc.cornell.edu writes:
- >I don't think it can be done. The problem is that reads/writes to
- floppy
- >disks are VERY time critical. Therefore, most OS's will disable
- interupts
- >and require the formatting code to run exclusively if you want a
- "properly"
- >formatted disk. This happens on the mac (that's why the mouse "jumps"
- when
- >you are formatting disks...the mouse is interupt driven), so I don't
- think
- >you're going to be able to get around it with Apple's routines...You
- could
- >always write your own disk I/O routines :) (just kidding).
-
- Unless you've got a IIfx (or Quadra 900/950 ?) because the on-board
- IO Processors handle all that messing around with floppies and leave
- the mouse tracking smooth as silk. [Heavy sigh]
-
- Of course hacking the disk initialisation package to run in the
- background would be fun (-;
-
- btw Does anyone know why the disk init package doesn't display
- a filler bar telling you how far it's got? It seems like a user
- interface faux pas to me.
-
- Quinn "The Eskimo!" <quinn@cs.uwa.edu.au> "Support HAVOC!"
- Department of Computer Science, The University of Western Australia
- -- Inquiring minds want to know where the phrase "Inquiring minds
- want to know" comes from.
-
- +++++++++++++++++++++++++++
-
- From: mikeh@kralizec.zeta.org.au (Michael Hore)
- Date: 30 Sep 92 09:27:47 GMT
- Organization: Kralizec Dialup Unix Sydney: +61-2-837-1183 V.32
-
-
- Quinn "The Eskimo!" writes:
-
- >btw Does anyone know why the disk init package doesn't display
- >a filler bar telling you how far it's got? It seems like a user
- >interface faux pas to me.
-
- I'd agree with that. As far as I remember the user interface to the
- DIP has hardly changed since System 1! Of course the rest of the
- package has evolved to handle HD disks, mapping out of bad blocks
- under Sys 7, and so on, but not the interface.
-
- I think it was probably just so low on the priority list that it
- sort of dropped off the bottom without anyone noticing :-)
-
- - -- Mike.
-
- - --------------------------------------------------------
- Mike Hore Internet: mikeh@kralizec.zeta.org.au
-
- ---------------------------
-
- From: cfpdh@ux1.cts.eiu.edu (Peter Hesterman)
- Subject: TCL/UnloadSeg Help Needed
- Date: 25 Sep 92 14:23:16 GMT
- Organization: Eastern Illinois University
-
- My TCL project includes numerous segments which contain only code
- associated with TCL objects that are infrequently used by the program. In
- the event of a memory shortage, I would like to mark these code segments
- as purgeable. Is it possible to identify one of the methods belonging to
- one of the objects as the argument for UnloadSeg()? I have tried
- something like UnloadSeg(MyObject::IMyObject) but got a access denied
- error. UnloadSeg(IMyObject) didn't work at all. My work-around has been
- to add a dummy file containing a dummy function to each of these segments
- and then UnloadSeg(Dummy). Have I missed the boat here, is there a more
- elegant way of doing it, etc.?
-
- Thanks in advance.
-
- Peter Hesterman
- cfpdh@eiu.edu
-
- +++++++++++++++++++++++++++
-
- From: tree@kira.uvm.edu (Tom Emerson)
- Date: 28 Sep 92 12:32:40 GMT
- Organization: University of Vermont, EMBA Computer Facility
-
- In article <1992Sep25.142316.21541@ux1.cts.eiu.edu> cfpdh@ux1.cts.eiu.edu (Peter Hesterman) writes:
-
- My TCL project includes numerous segments which contain only code
- associated with TCL objects that are infrequently used by the program. In
- the event of a memory shortage, I would like to mark these code segments
- as purgeable. Is it possible to identify one of the methods belonging to
- one of the objects as the argument for UnloadSeg()? I have tried
- something like UnloadSeg(MyObject::IMyObject) but got a access denied
- error. UnloadSeg(IMyObject) didn't work at all. My work-around has been
- to add a dummy file containing a dummy function to each of these segments
- and then UnloadSeg(Dummy). Have I missed the boat here, is there a more
- elegant way of doing it, etc.?
-
- The dummy function technique is the easiest to implement. You could also write
- code to unload segments a la MacApp, i.e. mark a group to be unloaded each
- time through the event loop. If you know the name (or number) of each segment
- (each is called Segx, where x is between 2 and 2+the number of segments in
- your project. The first segment in your project window is segment 2) you can
- get a handle to them with GetResource (or GetNamedResource), add the first
- word of resource (the offset to that segments JT entry), then add the
- appropriate offsets (I think its A5+32+2, i.e. the value of A5 plus the offset
- to the beginning of the jump table plus the two bytes for the JUMP in the JT
- entry). You could write this has a chore that will unload your segments during
- idleProc time.
-
- Tom
- - --
- Tom Emerson Technical Support
- Language Products Group Symantec Corporation
- Internet: tree@uvm.edu
-
- ---------------------------
-
- From: sinteur@ooc.uva.nl (John Sinteur)
- Subject: ProcPtr, how to call Proc pointed to?
- Date: 25 Sep 92 14:47:31 GMT
- Organization: ooc.uva.nl
-
- What I need in a piece of pascal code is to call the procedure
- pointed to by a ProcPtr (one of the parameters to the proceudure).
-
- Now I seem to remember seeing this discussed a while ago, but can't find
- a reference to it.
-
- Can anybody help me out?
-
- - -John
-
- - --
- [ sinteur@ooc.uva.nl John Sinteur, 2:512/48 (fidonet) ]
- [ Snail: Jade str 28, 2332 RT Leiden, The Netherlands ]
- [ Fra der kracht der duken ud der liga ]
-
- +++++++++++++++++++++++++++
-
- From: tholle16@ursa.calvin.edu (Tim Hollebeek)
- Date: 25 Sep 92 16:06:30 GMT
- Organization: Calvin College
-
- sinteur@ooc.uva.nl (John Sinteur) writes:
-
- >What I need in a piece of pascal code is to call the procedure
- >pointed to by a ProcPtr (one of the parameters to the proceudure).
-
- The best way to do it is to write some inline code to do it ...
-
- procedure Call(p:ProcPtr);
- {
- move.l (a7)+,a0
- jmp (a0)
- }
- inline $xxxx,$xxxx,$xxxx;
-
- unfortunately I don't have a mac here or a list of opcodes, but it works
- well; several of my programs have used this strategy to simulate some of
- the aspects of Object Pascal in regular pascal.
-
-
- - --
- - ------------------------------------------------------------------------------
- Tim Hollebeek --- tholle16@usurp.calvin.edu
- - ------------------------------------------------------------------------------
- Hi! I'm not a real .signature virus ... but I play one on the net.
-
- +++++++++++++++++++++++++++
-
- From: rson@rhi.hi.is (Mimir Reynisson)
- Date: 29 Sep 92 10:05:05 GMT
-
-
- SOmething like
-
- static pascal Boolean DoProc(long param1, long param2, .. etc .. ProcPtr proc)
- = {0x205F, 0x4E90};
-
- This will pop the ProcPtr parameter of the stack and then JSR to it
-
- ---------------------------
-
- From: sc@argentic.gts.org (Sterling Chipperfield)
- Subject: Unloading Segments
- Date: 25 Sep 92 13:16:09 GMT
- Organization: Argentic BBS [Toronto, Ontario, Canada]
-
- I had a program set up so that each procedure was in a difference code
- segment. After the main event loop, I had each segment "unloaded". Why
- is it that some of the procedures worked fine, while others did not. When
- I removed the unloading portion of the program, everything seemed to run
- smoothly. Any ideas? Does one have to check that the segment is loaded
- before calling the unload command or does the computer know not to unload
- a segment that is not already there?
-
-
- Sterling Chipperfield <sc@argentic.gts.org> OR <sc@argentic.uucp>
-
- +++++++++++++++++++++++++++
-
- From: tree@kira.uvm.edu (Tom Emerson)
- Date: 28 Sep 92 12:37:48 GMT
- Organization: University of Vermont, EMBA Computer Facility
-
- In article <1791@argentic.gts.org> sc@argentic.gts.org (Sterling Chipperfield) writes:
-
- I had a program set up so that each procedure was in a difference code
- segment. After the main event loop, I had each segment "unloaded". Why
- is it that some of the procedures worked fine, while others did not. When
- I removed the unloading portion of the program, everything seemed to run
- smoothly. Any ideas? Does one have to check that the segment is loaded
- before calling the unload command or does the computer know not to unload
- a segment that is not already there?
-
- Calling unload seg on an unloaded segment is effectively a nop; it doesn't
- cause a problem. You can run into problems if a segment is unloaded and
- purged, and then a function attempts to return to a function in a purged
- segment: the return address is on the stack, and the return doesn't go through
- the jump table and you shoot off into random data. Messy.
-
- Tom
- - --
- Tom Emerson Technical Support
- Language Products Group Symantec Corporation
- Internet: tree@uvm.edu
-
- ---------------------------
-
- From: trinkad@fog.cs.orst.edu (Darald Trinka)
- Subject: Get sender address from an AppleEvent
- Date: 25 Sep 92 18:12:33 GMT
- Organization: OSU
-
-
- Can some one tell me if this is the correct way to get the
- sender's address out of an AppleEvent so I send a message back at some
- latter time.
-
-
- extern AEDesc replyAddress; /* Global */
-
- pascal OSErr MyHandleShowText(theAppleEvent, reply, handlerRefcon)
- AppleEvent theAppleEvent,reply;
- long handlerRefcon;
- {
- OSErr myErr;
- DescType typeCode;
- int sessionRefNum;
-
- ... < some code taken out >
-
- /* get session ref number */
- myErr = AEGetAttributePtr(&theAppleEvent, keyEventSourceAttr,
- typeShortInteger, &typeCode, (Ptr) &sessionRefNum, sizeof(int),
- &actualSize);
- if (myErr != noErr) DoError(myErr);
- /* generate AEDesc from sessionRefNum */
- myErr = AECreateDesc(typeSessionID, (Ptr) &sessionRefNum,
- sizeof( PPCSessRefNum), &replyAddress);
- if (myErr != noErr) DoError(myErr);
-
-
- ... < more code >
-
- +++++++++++++++++++++++++++
-
- From: grobbins@Apple.COM (Grobbins)
- Date: 27 Sep 92 22:33:15 GMT
- Organization: Apple Computer Inc., Cupertino, CA
-
- In article <1992Sep25.181233.28698@CS.ORST.EDU> trinkad@fog.cs.orst.edu (Darald Trinka) writes:
- > Can some one tell me if this is the correct way to get the
- >sender's address out of an AppleEvent so I send a message back at some
- >latter time.
- >
- >myErr = AEGetAttributePtr(&theAppleEvent, keyEventSourceAttr,
- > typeShortInteger, &typeCode, (Ptr) &sessionRefNum, sizeof(int),
- > &actualSize);
-
- The event source attribute is a number indicating how the event
- was transmitted (directly from the same process, from another
- process on the machine, and so forth.) It is a short containing
- the equivalent of an enumerated from this list (taken from
- AppleEvents.p):
-
- AEEventSource = (kAEUnknownSource, kAEDirectCall, kAESameProcess,
- kAELocalProcess, kAERemoteProcess);
-
- This event source information is rarely useful.
-
- To find the sender of an Apple event, use AEGetAttributePtr to extract
- the address attribute (keyAddressAttr) of the event. It will be a
- process serial number or target ID. Use the same buffer (and the same
- data type) to later create a new address descriptor. This is discussed
- on page 107 of issue 10 of develop magazine.
-
- Grobbins grobbins@apple.com
-
- Usual disclaimers apply.
-
- +++++++++++++++++++++++++++
-
- From: lai@Apple.COM (Ed Lai)
- Date: 28 Sep 92 16:38:08 GMT
- Organization: Apple Computer Inc., Cupertino, CA
-
- >myErr = AEGetAttributePtr(&theAppleEvent, keyEventSourceAttr,
- > typeShortInteger, &typeCode, (Ptr) &sessionRefNum, sizeof(int),
- > &actualSize);
-
- Event source just classify where the event is coming from (local, remote etc).
-
- You want to get it using the keyword keyAddressAttr, ask for typeTargetID,
- but just the fact that the session id is the first 4 bytes of a target ID, so
- you can ask for just four bytes.
-
- /* Disclaimer: All statments and opinions expressed are my own */
- /* Edmund K. Lai */
- /* Apple Computer, MS37-UP */
- /* 20525 Mariani Ave, */
- /* Cupertino, CA 95014 */
- /* (408)974-6272 */
- zW@h9cOi
-
- ---------------------------
-
- From: liaj0032@ac.dal.ca
- Subject: GrowZone & A5
- Date: 17 Sep 92 01:59:23 GMT
- Organization: Dalhousie University, Halifax, Nova Scotia, Canada
-
- This is a question which I posed on a local bulletin board, but to which
- I did not receive a satisfactory answer.
- My program uses a growZone function in case I am running out of heap space. In
- a tech note (i think it's #180), it says that A5 is not guaranteed to be
- pointing to the application's globals when GrowZone is called, since it could
- be called by the system.
- It recommends in a tech note that SetUpA5 and RestoreA5 should be used to solve
- this problem. However, these two routines are later discouraged, having been
- replaced by SetA5 and SetCurrentA5, which do not however store A5 in a global
- memory location.
- Since GrowZone is not really called by the programmer, she or he is unable to
- use the trick advocated in the tech notes to get A5 to completion routines or
- VBL routines by using the address of the parameter block to locate A5. Since
- GrowZone doesn't have a parameter block, and you, as programmer, don't call
- it anyways, how can you ensure that A5 points to your application's globals if
- your GrowZone routine is called!!??
- (p.s. this is the first time I've used internet, and my first time on vms in
- over six years so if something goes wonky here i'll get better!)
-
- Thanks for the help. I'm sure this question has kept many programmers up at
- night...
-
- Sean McDowell
-
- +++++++++++++++++++++++++++
-
- From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
- Date: 25 Sep 92 23:02:52 GMT
- Organization: Kalamazoo College
-
- liaj0032@ac.dal.ca writes:
- >It recommends in a tech note that SetUpA5 and RestoreA5 should be used to solve
- >this problem. However, these two routines are later discouraged, having been
- >replaced by SetA5 and SetCurrentA5, which do not however store A5 in a global
- >memory location.
-
- Hmmmm...according to TN208, SetCurrentA5 just loads the contents of
- CurrentA5 into the A5 register. I.e. it _does_ use the low-mem global.
- Look at the code on the last page of that note.
- - --
- Jamie McCarthy Internet: k044477@kzoo.edu AppleLink: j.mccarthy
- I'm your only friend, I'm not your only friend, but I'm a little glowing
- friend, but really I'm not actually your friend, but I am...
-
- +++++++++++++++++++++++++++
-
- From: REEKES@applelink.apple.com (Jim Reekes)
- Date: 28 Sep 92 20:21:42 GMT
- Organization: Apple Computer, Inc.
-
- In article <1992Sep16.225923.7580@ac.dal.ca>, liaj0032@ac.dal.ca wrote:
- >
- > This is a question which I posed on a local bulletin board, but to which
- > I did not receive a satisfactory answer.
- > My program uses a growZone function in case I am running out of heap space. In
- > a tech note (i think it's #180), it says that A5 is not guaranteed to be
- > pointing to the application's globals when GrowZone is called, since it could
- > be called by the system.
- > It recommends in a tech note that SetUpA5 and RestoreA5 should be used to solve
- > this problem. However, these two routines are later discouraged, having been
- > replaced by SetA5 and SetCurrentA5, which do not however store A5 in a global
- > memory location.
- > Since GrowZone is not really called by the programmer, she or he is unable to
- > use the trick advocated in the tech notes to get A5 to completion routines or
- > VBL routines by using the address of the parameter block to locate A5. Since
- > GrowZone doesn't have a parameter block, and you, as programmer, don't call
- > it anyways, how can you ensure that A5 points to your application's globals if
- > your GrowZone routine is called!!??
- > (p.s. this is the first time I've used internet, and my first time on vms in
- > over six years so if something goes wonky here i'll get better!)
-
- The routine below was taken from the MacDTS sample code SoundApp.
-
- FUNCTION MyGrowZone(cbNeeded: Size): LONGINT;
-
- {This is a very basic grow zone procedure. My application keeps a reserve
- handle of memory in case the Memory Manager gets a request for some memory
- that is not available in my heap. If memory were to get tight (<32k),
- the Toolbox will crash the system, especially Quickdraw. Before releasing
- the reserve handle I make sure it isnUt the GZSaveHnd. This handle cannot
- be touched by the grow zone procedure.
-
- WARNING: The grow zone procedure will be called and A5 may not be valid.
- Read Tech Note #136 and 208}
-
- VAR
- theA5: LONGINT;
-
- BEGIN
- theA5:= SetCurrentA5;
- IF (gReserveMemory^ <> NIL) & (gReserveMemory <> GZSaveHnd) THEN BEGIN
- EmptyHandle(gReserveMemory);
- MyGrowZone:= kSizeOfReserve; {released this much
- memory}
- END ELSE
- MyGrowZone:= 0; {this may release more
- memory}
- theA5:= SetA5(theA5);
- END; {MyGrowZone}
-
-
- - -----------------------------------------------------------------------
- Jim Reekes, Polterzeitgeist | Macintosh Toolbox Engineering
- | Sound Manager Expert
- Apple Computer, Inc. | RAll opinions expressed are mine, and do
- 20525 Mariani Ave. MS: 81-KS | not necessarily represent those of my
- Cupertino, CA 95014 | employer, Apple Computer Inc.S
-
- ---------------------------
-
- From: mwu@orion.oac.uci.edu (Matt Wu)
- Subject: Measuring text in different fonts
- Organization: University of California, Irvine
- Date: 30 Sep 92 20:23:53 GMT
-
-
- I'm currently writing a program that will need to measure the width of
- text as it will appear on a written page. I've been using the stringwidth
- function to do this. However, as the Macintosh uses bit-mapped fonts,
- I was wondering how accurate this would be as compared to, say, final
- output out of a PostScript laserprinter? If this is not a very accurate way
- of measuring text width, can you offer any suggestions as to how I could
- get better results?
-
- Thanks,
-
- Matt
- mwu@orion.oac.uci.edu
-
- +++++++++++++++++++++++++++
-
- From: de19@umail.umd.edu (Dana S Emery)
- Date: 1 Oct 92 02:10:44 GMT
- Organization: Personal
-
- In article <2ACA0CD9.12346@news.service.uci.edu>, mwu@orion.oac.uci.edu
- (Matt Wu) wrote:
- >
- >
- > I'm currently writing a program that will need to measure the width of
- > text as it will appear on a written page. I've been using the stringwidth
- > function to do this. However, as the Macintosh uses bit-mapped fonts,
- > I was wondering how accurate this would be as compared to, say, final
- > output out of a PostScript laserprinter? If this is not a very accurate way
- > of measuring text width, can you offer any suggestions as to how I could
- > get better results?
-
- Matt, this is a rather large can of worms.
-
- First, it is difficult for a program to know if a PS font will be used for
- imageing. Second, the bitmap width tables are nowhere near as precise as
- the actual PS glyph tables, so that brings up the Q of obtaining better
- information (assuming you actually need it). Third, all of this assumes
- that your code is aware of whatever kerning is going to be imposed. One
- impractical strategy would be to attempt to debreif the actual PS font, but
- that involves access to it (printer/printer disk residency, maybe even
- remote print site) and considerable greif deencodeing it.
-
- A better strategy would be to reference the fonts AFM file which is
- available for all adobe (and many other) type 1 fonts. I beleive adobe
- makes the afm and the bitmaps available essentially as freeware for all its
- fonts (but dont quote me), so it is not unreasonable to require that your
- users supply them. One could also depend on the ATM programatic hooks,
- with the afm (and QD) as backup.
-
- Currently, QD, TT, and PS fonts are supported. PS differ from QD fonts in
- that they have an associated 'LWFN' file whose name is described by an
- optional table in the 'FOND' resource. TT fonts are defined by an 'sfnt'
- resource which bundles both the bitmaps and the PS code. Conceivably, a
- similar wrapper could be designed for PS fonts, but that is vaporware at
- the present.
-
- So, your code has a text run which uses a given font/face/size, and you
- want to calculate its width. You need to get access to the FOND resource,
- and debreif it to see if the PS name table exists (If not, use existing QD
- technology). If PS, then check for ATM, and get it to measure the text for
- you. If no ATM, then look for the relevant afm file, and parse it for the
- characters used. A great deal of this is implemented by the LW driver,
- which you could explore with your fav disassembler.
-
- Ref: IM 1, 4, 5, 6; revIM font chapter, in 'text' (i think); Adobe AFM
- specification; Adobe ATM programmers hook stuf (sorry, I forget the
- official title).
-
- You might want to read the comp.lang.postscript FAQ for info on dealing
- with the automated adobe technical document server, and the revIM font
- chapter can be gotten from ftp.apple.com, or from the ETO/develop CD-roms.
-
- - --
-
- Dana S Emery <de19@umail.umd.edu> | "Novo, de Novo,
- | de novo, de no-o-o-o-o---,
- | Novemba come an' dey gonna go home."
-
- ---------------------------
-
- From: David Johnston <davidj@daveland.demon.co.uk>
- Subject: MacTCPCommonTypes & typedef unsigned char b_8.
- Organization: Daveland Developments
- Date: Sat, 26 Sep 1992 17:33:24 GMT
-
- I've been doing some 'Lets grope in the dark TCP programming' and
- have run up against a somewhat bizarre problem.
-
- To get started I tried to compile a piece of Apple code (I think
- from ftp.apple.com) called tcpserver what is a simple greeting
- server (Under Think C).
- It fell over wanting MacTCPCommonTypes.h, so I found me a copy
- of this somewhere and stuck it in. It then fell over with
- "Illegal redeclaration of b_8"
- at the line "typedef unsigned char b_8" in MacTCPCommonTypes.h.
-
- Fair enough, *except* I've scanned every last byte of my hard
- disk and can't find any file or library which refers to b_8.
-
- How can I be redeclaring this? Why doesn't the rest of the world
- have this problem? And why aren't I more succesful with women?
- Are these problems linked? Inquring minds want to know.
-
- - -----------------------------------------------------------------
- David Johnston: davidj@daveland.demon.co.uk (Home IP connection)
- - -----------------------------------------------------------------
-
- +++++++++++++++++++++++++++
-
- From: de19@umail.umd.edu (Dana S Emery)
- Date: 27 Sep 92 14:48:53 GMT
- Organization: Personal
-
- In article <Bv74rq.5EH@gate.demon.co.uk>, davidj@daveland.demon.co.uk
- (David Johnston) wrote:
-
- [...]
-
- > It fell over wanting MacTCPCommonTypes.h, so I found me a copy
- > of this somewhere and stuck it in. It then fell over with
- > "Illegal redeclaration of b_8"
- > at the line "typedef unsigned char b_8" in MacTCPCommonTypes.h.
- >
- > Fair enough, *except* I've scanned every last byte of my hard
- > disk and can't find any file or library which refers to b_8.
- >
- > How can I be redeclaring this? Why doesn't the rest of the world
- > have this problem? And why aren't I more succesful with women?
- > Are these problems linked? Inquring minds want to know.
- >
-
- I have had some difficulty dealing with Thc 5.0.3 on a project started
- under 5.0.2, in my case the linker is declareing a symbol undefined which
- neither I nor Symantec DTS can locate.
-
- I wonder if they test this stuff the same way we do?
-
- - --
-
- Dana S Emery <de19@umail.umd.edu> | "Novo, de Novo,
- | de novo, de no-o-o-o-o---,
- | Novemba come an' dey gonna go home."
-
- +++++++++++++++++++++++++++
-
- From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
- Date: 29 Sep 92 04:15:55 GMT
- Organization: University of Waikato, Hamilton, New Zealand
-
- In article <Bv74rq.5EH@gate.demon.co.uk>, David Johnston <davidj@daveland.demon.co.uk> writes:
- > I've been doing some 'Lets grope in the dark TCP programming' and
- > have run up against a somewhat bizarre problem.
- >
- > To get started I tried to compile a piece of Apple code (I think
- > from ftp.apple.com) called tcpserver what is a simple greeting
- > server (Under Think C).
- > It fell over wanting MacTCPCommonTypes.h, so I found me a copy
- > of this somewhere and stuck it in. It then fell over with
- > "Illegal redeclaration of b_8"
- > at the line "typedef unsigned char b_8" in MacTCPCommonTypes.h.
- >
- > Fair enough, *except* I've scanned every last byte of my hard
- > disk and can't find any file or library which refers to b_8.
-
- (Does a quick check) As I suspected--this is the first typedef in
- MacTCPCommonTypes.h.
-
- What this means is that you must be #including MacTCPCommonTypes.h
- more than once, either directly or indirectly. Now all you have to do
- is track it down...
-
- Lawrence "This would never happen with Modula-2" D'Oliveiro
- Usenet DBcc specialist
-
- +++++++++++++++++++++++++++
-
- From: de19@umail.umd.edu (Dana S Emery)
- Date: 28 Sep 92 16:04:30 GMT
- Organization: Personal
-
- In article <de19-270992104602@mac19-pg2.umd.edu>, de19@umail.umd.edu (Dana
- S Emery) wrote:
- >
- > In article <Bv74rq.5EH@gate.demon.co.uk>, davidj@daveland.demon.co.uk
- > (David Johnston) wrote:
- >
- > [...]
- >
- > I have had some difficulty dealing with Thc 5.0.3 on a project started
- > under 5.0.2, in my case the linker is declareing a symbol undefined which
- > neither I nor Symantec DTS can locate.
- >
- > I wonder if they test this stuff the same way we do?
- >
- > --
- >
- > Dana S Emery <de19@umail.umd.edu>
-
- As a follow up to the above, I must mention that the problem alluded to
- failed to replicate itself when I reconstructed the project file from
- scratch, implying that it had somehow become corrupted.
-
- Since this presumed corruption affected a project which has never been
- executed, I am even more puzzled.
-
- Stay tuned for further developments.
-
- Oh, BTW, the symptom was a spurious link failure, referencing an
- (undefined) external symbol which n'exist pas, either in my code or in
- symantec's.
-
- - --
-
- Dana S Emery <de19@umail.umd.edu> | "Novo, de Novo,
- | de novo, de no-o-o-o-o---,
- | Novemba come an' dey gonna go home."
-
- +++++++++++++++++++++++++++
-
- From: moonshadow@cs.stanford.edu (Sean White)
- Organization: Stanford University CSLI
- Date: Mon, 28 Sep 1992 18:47:15 GMT
-
- In article <1992Sep28.161555.11063@waikato.ac.nz> ldo@waikato.ac.nz
- (Lawrence D'Oliveiro, Waikato University) writes:
- > In article <Bv74rq.5EH@gate.demon.co.uk>, David Johnston
- <davidj@daveland.demon.co.uk> writes:
- >
- > What this means is that you must be #including MacTCPCommonTypes.h
- > more than once, either directly or indirectly. Now all you have to do
- > is track it down...
- >
- > Lawrence "This would never happen with Modula-2" D'Oliveiro
- > Usenet DBcc specialist
-
- Or use #pragma once at the top of MacTCPCommonTypes.h
- - --
- Sean Michael White
- moonshadow@cs.stanford.edu "I'm bein' followed by a Moonshadow"
-
-
- +++++++++++++++++++++++++++
-
- From: davidj@daveland.demon.co.uk (David Johnston)
- Date: 29 Sep 92 17:25:22 GMT
- Organization: Daveland Developments
-
- In article <de19-280992115841@mac19-pg2.umd.edu> Dana S Emery,
- de19@umail.umd.edu writes:
- >Oh, BTW, the symptom was a spurious link failure, referencing an
- >(undefined) external symbol which n'exist pas, either in my code or in
- >symantec's.
- >
-
- Yep, the problem seems to be related to trying to compile stuff
- from other versions of Think (I'm on 5.02). It falls over at
- the first typedef in rather ill-defined circumstances. The header
- file certainly wasn't included twice since I added conditionals
- to prevent that.
-
- - -----------------------------------------------------------------
- David Johnston: davidj@daveland.demon.co.uk (Home IP connection)
- - -----------------------------------------------------------------
-
- ---------------------------
-
- From: ramirez@mcclb0.med.nyu.edu
- Subject: Postscript downloading.
- Organization: NYU Medical Center, New York, NY 10016, USA
- Date: Sat, 26 Sep 1992 22:12:03 GMT
-
- Hello all,
-
- I am looking for the source code (C, C++ or Pascal) to download a
- PostScript file to a Laserwriter II. I need to be able to parse the header
- (%%) Fields. I need to get the name of the machine that created it and the
- number of pages.
-
- I would also appreciate if someone recomends some documentation that
- explains how to do this.
-
- Thanks in advance.
- Edwin Ramirez.
-
- +++++++++++++++++++++++++++
-
- From: zaphod@bluemoon.rn.com (Peter Bierman)
- Organization: Blue Moon BBS ((614) 868-998[024])
- Date: Sat, 26 Sep 92 22:42:36 EDT
-
- ramirez@mcclb0.med.nyu.edu writes:
-
- > I am looking for the source code (C, C++ or Pascal) to download a
- > PostScript file to a Laserwriter II. I need to be able to parse the header
- > (%%) Fields. I need to get the name of the machine that created it and the
- > number of pages.
-
- I don't know if this helps, but I remember reading somewhere that the LW
- driver parses out something like "EnamulatorFont" or some name of a font
- that when it encounters, it will send as postscript to the printer.
-
- The cool thing about this was that you could use Font/DA mover and resedit
- to make a copy of something like monaco and rename it the name of this
- trigger font, and then just print postscript straight from any word
- processor, or printing code.
-
-
- - ---
- The opinions I express are rarely my own, because my own are far too
- outragous to post here.
-
- IntNet:zaphod@bluemoon.use.com FutureNet: #33@#10
- The Metropolis (614)-846-1911
- - ---
-
- +++++++++++++++++++++++++++
-
- From: d88-jwa@dront.nada.kth.se (Jon Wtte)
- Date: 27 Sep 92 09:34:05 GMT
- Organization: Royal Institute of Technology, Stockholm, Sweden
-
- > zaphod@bluemoon.rn.com (Peter Bierman) writes:
-
- I don't know if this helps, but I remember reading somewhere that the LW
- driver parses out something like "EnamulatorFont" or some name of a font
- that when it encounters, it will send as postscript to the printer.
-
- Wasn't the name "PostScript Escape" ?
-
- - --
- Jon W{tte, h+@nada.kth.se, Sweden, Phone +46-8-107069
-
- "From now on, I think I'll re-label the EQ on the
- desk as Fizz and Wobble, rather than HF and LF."
-
- ---------------------------
-
- From: jeremyr@dcs.qmw.ac.uk (Jeremy Roussak)
- Subject: popup menus in non-system font
- Date: 10 Sep 92 21:40:27 GMT
- Organization: Computer Science Dept, QMW, University of London
-
- Well, the last time I asked about this everyone was very
- helpful, so here goes again.
-
- I want a popup menu to appear in a non-system font and size.
- There's something about this in the Q&A stack, so I followed
- Apple's advice. My code looks like this:
-
- SysFontFam = (*v.options)->menuFont;
- SysFontSize = (*v.options)->menuSize;
- LastSPExtra = CurFMInput = -1;
-
- then PopUpMenuSelect, then reset SysFontFam and SysFontSize and
- invalidate the other two globals again.
-
- Now, this works a treat. Until, that is, I run an app like
- MSWord (are there any?) or even, I am told, MacWrite IIJ. Then
- (and sometimes for no apparent reason), although the font
- changes for the popup, the size doesn't: it stays at 12 point.
- Checking with MacsBug, SysFontSize is set to 9.
-
- The problem persists after running MSWord, even after quitting
- it. Sometimes it will then go away again, but more often it
- persists until I reboot.
-
- All help gratefully acknowledged... please?
-
- Jeremy
-
- +++++++++++++++++++++++++++
-
- From: engber@ils.nwu.edu (Mike Engber)
- Date: 11 Sep 92 15:25:31 GMT
- Organization: The Institute for the Learning Sciences
-
-
- Yes, it seems that certain applications change the window manager's
- font setting and don't restore them. Leonard Rosenthal told me
- about this. The workaround he suggested was to reset them myself.
- After playing around with it a while I discovered that you had
- to reset them in both the window manager port AND the color window
- manager port (if colorQD is avail) - or under some circumstances
- (which I can't recall) there are problems.
-
- Anyway, here is my version of PopUpMenuSelect (written in THINK C)
- which let's you specify that you want the menu popped up in the
- current port's font and size.
-
- - -ME
-
- - ---
-
- extern short SysFontFam : 0x0BA6;
- extern short SysFontSize : 0x0BA8;
- extern long LastSpExtra : 0x0B4C;
- extern Ptr CurFMInput : 0x0988;
-
- long PupSelect(MenuHandle theMenu,Point popPt,short popUpItem,Boolean useWFont){
- short item;
- short oldSysFont = SysFontFam;
- short oldSysSize = SysFontSize;
- GrafPtr curPort;
-
- GetPort(&curPort);
-
- /* no need to muck around if the current font is already the system font */
- if(curPort->txFont==SysFontFam && curPort->txSize==SysFontSize){
- useWFont = false;
- }
-
- if(useWFont){
-
- { /* this hack fixes bugs caused by programs that mess up
- the WindowMgr port (e.g. MacWrite & Word)
- */
- GrafPtr wPort;
- SysEnvRec theWorld;
- GetWMgrPort(&wPort);
- SetPort(wPort);
- TextSize(0);
- TextFont(0);
- if(SysEnvirons(1,&theWorld) == noErr && theWorld.hasColorQD){
- CGrafPtr wCPort;
- GetCWMgrPort(&wCPort);
- SetPort((GrafPtr)wCPort);
- TextSize(0);
- TextFont(0);
- }
- SetPort(curPort);
- }
-
- SysFontFam = curPort->txFont;
- SysFontSize = curPort->txSize;
- LastSpExtra = -1L;
- CurFMInput = (Ptr)(-1L);
- SetItemMark(theMenu,popUpItem,'%');
- }else{
- CheckItem(theMenu,popUpItem,true);
- }
-
- item = PopUpMenuSelect(theMenu,popPt.v,popPt.h,popUpItem);
- CheckItem(theMenu,popUpItem,false);
-
- if(useWFont){
- SysFontSize = oldSysSize;
- SysFontFam = oldSysFont;
- LastSpExtra = -1L;
- CurFMInput = (Ptr)-1L;
- }
-
- return item;
- }
-
- +++++++++++++++++++++++++++
-
- From: alexr@apple.com (Alexander M. Rosenberg)
- Date: 11 Sep 92 17:10:32 GMT
- Organization: Hackers Anonymous
-
- In article <1992Sep10.214027.7936@dcs.qmw.ac.uk> Jeremy Roussak,
- jeremyr@dcs.qmw.ac.uk writes:
- >Now, this works a treat. Until, that is, I run an app like
- >MSWord (are there any?) or even, I am told, MacWrite IIJ. Then
- >(and sometimes for no apparent reason), although the font
- >changes for the popup, the size doesn't: it stays at 12 point.
- >Checking with MacsBug, SysFontSize is set to 9.
- >
- >The problem persists after running MSWord, even after quitting
- >it. Sometimes it will then go away again, but more often it
- >persists until I reboot.
-
- This is the result of some _very_ sloppy programming on the parts
- of Claris, Microsoft, etc.
-
- They have a custom MDEF that draws their cute little up-shift arrow
- symbol and the like. MDEFs draw in the Window Manager port. They
- change some values in that port and don't restore them.
-
- In particular, the text size field is frequently changed to 12.
- What was wrong:
-
- 1.) They changed the value of a system-wide structure for a specific
- purpose and didn't restore it.
-
- 1A.) (Only in some applications) Instead of using a trap to change these
- values, they slam them directly into the structure, despite years of
- Apple recommending otherwise.
-
- 2.) They typically set the font to 0 and the size to 12. This is incorrect.
- The system font is 0, and the system font size is 0. Size 12 is not correct
- for a Kanji system, for one.
-
- 3.) Your pop-up is drawn in the Window Manager Port by the sytem supplied
- MDEF. You've temporarily changed the system font and size to be the font
- and size you want. It ends up being drawn in the correct font at the size
- that the application slammed in in step 2, typically 12.
-
- What have we learned?
-
- 1.) Don't be a bad dog!
-
- 2.) Save and restore all system-wide things you change unless the intent
- is for the change to affect others.
-
- 3.) Listen carefully to the statements that DTS has to say.
-
- 4.) Save the current Window Manager port font and size and set them, via
- the correct _TextFont and _TextSize traps to 0 around your call to
- PopUpMenuSelect.
-
- 5.) The pop-up control in System 7 was fixed this way in System 7 Release 7.1.
- - ---------------------------------------------------------------------------
- - - Alexander M. Rosenberg - INTERNET: alexr@apple.com - Yoyodyne -
- - - 330 Waverley St., Apt B - UUCP:ucbvax!apple!alexr - Propulsion -
- - - Palo Alto, CA 94301 - - Systems -
- - - (415) 329-8463 - Nobody is my employer so - :-) -
- - - (408) 974-3110 - nobody cares what I say. - -
-
- +++++++++++++++++++++++++++
-
- From: walkerj@math.scarolina.edu (Jim Walker)
- Date: 11 Sep 92 04:14:44 GMT
- Organization: USC Department of Computer Science
-
- In <1992Sep10.214027.7936@dcs.qmw.ac.uk> jeremyr@dcs.qmw.ac.uk (Jeremy Roussak) writes:
-
- >I want a popup menu to appear in a non-system font and size.
- >There's something about this in the Q&A stack, so I followed
- >Apple's advice. My code looks like this:
-
- >SysFontFam = (*v.options)->menuFont;
- >SysFontSize = (*v.options)->menuSize;
- >LastSPExtra = CurFMInput = -1;
-
- >then PopUpMenuSelect, then reset SysFontFam and SysFontSize and
- >invalidate the other two globals again.
-
- >Now, this works a treat. Until, that is, I run an app like
- >MSWord (are there any?) or even, I am told, MacWrite IIJ. Then
- >(and sometimes for no apparent reason), although the font
- >changes for the popup, the size doesn't: it stays at 12 point.
- >Checking with MacsBug, SysFontSize is set to 9.
-
- >The problem persists after running MSWord, even after quitting
- >it. Sometimes it will then go away again, but more often it
- >persists until I reboot.
-
- Here's an answer, archived from CompuServe:
-
- |Date: Wed, Aug 19, 1992 11:32:27 AM
- |Subject: #95335-PopUpMenuSelect + style
- |From: Spec Bowers 70731,3710
- |To: Ken Elston 71251,310
- |
- |
- |Ken,
- |
- |It's a bug in several Microsoft products. You can program around it but it's a
- |nuisance.
- |
- |The Window Manager's port is normally set to size 0, system standard.
- |Microsoft comes along and sets it to size 12 and doesn't restore it.
- |
- |The technique described in previous messages for setting font and size for a
- |popup menu, simply sets the system standard. Whenever a port is using size 0,
- |it uses the standard size stored in the low memory globals. If the port is set
- |to 12 or any other size, the default size is ignored.
- |
- |The cure is to set the window manager's port (WMGRPort) to size 0 before
- |calling PopupMenuSelect. You'll have to save the current port, get the WMGR
- |port, set the current port to be the WMGR port, set the size to 0, then
- |restore the current port to the original. You probably should reverse the
- |process after PopupMenuSelect returns. It is proper practice to restore port
- |settings. On the other hand the proper setting for the WMGR port is 0.
- |
- |
- |Spec Bowers
- |Bowers Development
- |(developers of AppMaker)
-
- - --
-
- -- Jim Walker USC Dept. of Math. walkerj@math.scarolina.edu
-
- +++++++++++++++++++++++++++
-
- From: resnick@cogsci.uiuc.edu (Pete Resnick)
- Date: 26 Sep 92 23:58:45 GMT
- Organization: University of Illinois at Urbana
-
- In this discussion, people mentioned that if you do reset the Window
- Manager's port so that the text size is 0, you should return it to the
- (wrong) value that it was before, as evidently System 7.1 does. Can
- anyone out there think of reasons that this would be necessary? I
- would like to do this, but the code I am writing makes it pretty
- impossible to reset the port before each and every call to
- PopUpMenuSelect. What would I screw up by permanently changing it to
- 0?
-
- Thanks,
-
- pr
- - --
- Pete Resnick (...so what is a mojo, and why would one be rising?)
- Graduate assistant - Philosophy Department, Gregory Hall, UIUC
- System manager - Cognitive Science Group, Beckman Institute, UIUC
- Internet: resnick@cogsci.uiuc.edu
-
- +++++++++++++++++++++++++++
-
- From: jeremyr@dcs.qmw.ac.uk (Jeremy Roussak)
- Date: 28 Sep 92 07:06:23 GMT
- Organization: Computer Science Dept, QMW, University of London
-
- In <Bv7MLy.EA5@news.cso.uiuc.edu> resnick@cogsci.uiuc.edu (Pete Resnick) writes:
-
- >In this discussion, people mentioned that if you do reset the Window
- >Manager's port so that the text size is 0, you should return it to the
- >(wrong) value that it was before, as evidently System 7.1 does. Can
- >anyone out there think of reasons that this would be necessary? I
- >would like to do this, but the code I am writing makes it pretty
- >impossible to reset the port before each and every call to
- >PopUpMenuSelect. What would I screw up by permanently changing it to
- >0?
-
- I started this thread, so I'll add my two-penn'orth.
-
- The txSize field of the WMgrPort (and WMgrCPort, if you have
- colour QD) should always (I think) be zero. Certain rogues,
- notably Microsoft and Claris (who should know better :-)), set
- it to the system font size in their custom MDEFs and don't
- reset it.
-
- It being good practice, you should probably restore any value
- you ever change in a structure which doesn't belong to you.
- However, I haven't done this in my INIT (Apollo) and I've been
- unable to detect any adverse effects.
-
- The answer to your question, though, depends on what you mean
- by "permanently". Unless you can guarantee that no-one else
- will change it to 12 (typically) during the execution of your
- program, you can't change the value to 0 "permanently", since
- (as I understand it) the WMgr(C)Port is a system-wide
- structure, not one of the ones of which each app has its own
- copy.
-
- Why is it so difficult for you to change it before each call?
- Can't you just write a sort of "glue"?
-
- Jeremy
-
- +++++++++++++++++++++++++++
-
- From: resnick@cogsci.uiuc.edu (Pete Resnick)
- Date: 28 Sep 92 18:36:19 GMT
- Organization: University of Illinois at Urbana
-
- jeremyr@dcs.qmw.ac.uk (Jeremy Roussak) writes:
-
- >The answer to your question, though, depends on what you mean
- >by "permanently". Unless you can guarantee that no-one else
- >will change it to 12 (typically) during the execution of your
- >program, you can't change the value to 0 "permanently", since
- >(as I understand it) the WMgr(C)Port is a system-wide
- >structure, not one of the ones of which each app has its own
- >copy.
-
- I was thinking of changing it to 0 on initialization and on every
- activate event, which should be permanent enough for me because...
-
- >Why is it so difficult for you to change it before each call?
- >Can't you just write a sort of "glue"?
-
- The problem is that I wanted to use the popupMenuCDEF in my control
- panel. Because this is a control panel, I don't get mouse-down events
- when the popup menu control has been hit. All I get is a hitDev
- message after the mouse has been released. That means that I can't
- pre-set txSize to 0 and then unset it after the menu has popped up. So
- if I reset it at initialization and whenever I get an activate event,
- I figured I would be safe. I may not do it anyway, just so I can say
- how horrible MS and Claris are in my "Known problems" section of the
- documentation. :-)
-
- Control panels are such a pain.
-
- pr
- - --
- Pete Resnick (...so what is a mojo, and why would one be rising?)
- Graduate assistant - Philosophy Department, Gregory Hall, UIUC
- System manager - Cognitive Science Group, Beckman Institute, UIUC
- Internet: resnick@cogsci.uiuc.edu
-
- ---------------------------
-
- End of C.S.M.P. Digest
- **********************
-